import { Card } from 'antd';
import './style.css'
import PageTitle from '../../../../components/textComp/PageTitle'
import { useSelector, useDispatch } from 'react-redux'
import { insert } from '../../../../store/modules/schemaSlice'
import { nanoid } from '@reduxjs/toolkit'

export default function () {
    const dispatch = useDispatch()

    const handleClick = function (type: string) {
        console.log(type)
        switch (type) {
            case 'questionPageTitle': {
                dispatch(insert({
                    id: nanoid(),
                    type: 'questionPageTitle',
                    props: {
                        text: '问卷标题',
                        desc: '问卷描述',
                        textAlign: 'true',
                    }
                }))
                break;
            }
            default: {
                console.log('finally')
            }
        }
    }

    return (
        <>
            <p>文本显示</p>
            <Card className="card" style={{ width: '300px' }} onClick={() => handleClick('questionPageTitle')}>
                <PageTitle></PageTitle>
            </Card>
            {/* // <Card style={{ width: 300, background: '#eee', marginBottom: '8px' }}>
            //     <h2>一行标题</h2>
            // </Card>
            // <Card style={{ width: 300, background: '#eee', marginBottom: '8px' }}>
            //     <p>一行段落</p>
            // </Card> */}
        </>
    )
}